<template>
    <div>
        <router-view></router-view>
        <van-tabbar v-model="active">
            <van-tabbar-item icon="idcard" to="/home">市民卡</van-tabbar-item>
            <van-tabbar-item icon="after-sale" info="5" to="/city_activity">城市活动</van-tabbar-item>
            <van-tabbar-item icon="home-o" to="/my_city_card">个人中心</van-tabbar-item>
        </van-tabbar>
    </div>
</template>
<script>
export default {
  data () {
    return {
      active: 0
    }
  },
  computed: {
    menuState () {
      return this.active
    }
  },
  watch: {
    $route (to, from) {
      console.log(from.path)// 从哪来
      if (to.path === '/') {
        this.active = 0
      } else if (to.path === '/tt') {
        this.active = 0
      } else if (to.path === '/my_city_card') {
        this.active = 0
      } else if (to.path === '/upgrade') {
        this.active = 0
      } else {
        this.active = 1
      }
    }
  }
}
</script>
<style>
    @import "../assets/common.css";
    @import "../assets/icons/iconfont.css";
</style>
